package com.homework.util;

import com.homework.bean.ConsumerComponent;

public class Consume implements Runnable {
    protected ConsumerComponent service;
    private String method;

    public Consume(ConsumerComponent s, String m) {
        service = s;
        method = m;
    }

    protected void call() {
        if(method == "A") {
            String s = service.aMethod();
        } else if(method == "B") {
            service.bMethod();
        } else if(method == "C") {
            service.cMethod();
        }
    }

    @Override
    public void run() {
        while (true) {
            call();
        }
    }
}
